﻿<UserControl x:Class="HighLandirect.Presentation.Views.ProductListView"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:c="clr-namespace:HighLandirect.Presentation.Converters"
    xmlns:p="clr-namespace:HighLandirect.Presentation.Properties"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:vm="clr-namespace:HighLandirect.Applications.ViewModels;assembly=HighLandirect.Applications"
    mc:Ignorable="d" d:DataContext="{d:DesignInstance vm:ProductListViewModel}">

    <DockPanel>
        <DockPanel.Resources>
            <c:NumberFormatter x:Key="myNumberFormatter"/>
        </DockPanel.Resources>
        <ToolBarTray DockPanel.Dock="Top">
            <ToolBar>
                <Button Command="{Binding AddNewCommand}" Content="{x:Static p:Resources.Add}" FontSize="14" />
                <Button Command="{Binding RemoveCommand}" Content="{x:Static p:Resources.Remove}" FontSize="14" />
            </ToolBar>
        </ToolBarTray>
        
        <ListView ItemsSource="{Binding Products}" SelectedItem="{Binding SelectedProduct}" 
                  SelectionChanged="ListViewSelectionChanged" FontSize="16">
            <ListView.View>
                <GridView>
                    <GridViewColumn DisplayMemberBinding="{Binding ProductID}" Header="ID" Width="50"/>
                    <GridViewColumn DisplayMemberBinding="{Binding ProductName}" Header="{x:Static p:Resources.ProductName}" Width="150"/>
                    <GridViewColumn DisplayMemberBinding="{Binding Tanka, Converter={StaticResource myNumberFormatter},ConverterParameter='#,##0'}" Header="{x:Static p:Resources.Tanka}" Width="100"/>
                </GridView>
            </ListView.View>
        </ListView>
    </DockPanel>

</UserControl>
